﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Newtonsoft.Json;

public partial class 湖南长沙_DayRep : System.Web.UI.Page
{
    BLL.BLLRep br = new BLL.BLLRep();
    public static string pName = "";
    public static string jpg = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        string name = HttpUtility.UrlDecode(Request.QueryString["name"]);
        if (name != null & name != "")
        {
            pName = name;
            if (name == "综合指标")
                name += "日报表";
            if (name == "综合指标统计")
            {
                name = name.Replace("统计", "");
                name += "日报表";
            }
            jpg = name;
        }

        string param = Request["param"];
        if (param != "")
        {
            if (param == "query")
            {
                string time = Request["time"];
                QueryTableList(pName, Convert.ToDateTime(time).ToString("yyyy-MM-dd"));
            }
        }
        else
        {
            string s = DateTime.Now.ToString();
            QueryTableList(pName, DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"));
        }
    }
    protected void QueryTableList(string pName, string time)
    {
        string strApp = br.RetTableByDay(pName, "日报", Convert.ToDateTime(time));
        int count = 1;
        object obj = null;
        if (pName == "综合指标")
        {
            count = 5;
            obj = new
           {
               num = 43,
               title = pName,
               count = count,
               tableInfo = strApp
           };
        }
        else if (pName == "综合指标统计")
        {
            count = 9;
            obj = new
           {
               num = count,
               title = pName,
               count = count,
               tableInfo = strApp
           };
        }
        else if (pName == "电煤油日报表")
        {
            count = 11;
            obj = new
           {
               num = count,
               title = pName,
               count = count,
               tableInfo = strApp
           };
        }

        string result = JavaScriptConvert.SerializeObject(obj);
        Response.Write(result);
        Response.End();
    }
}